<?php
    require("./Utils.php");

    $id = $_GET['id'];

    $conn = getConnection();
    $sql = "SELECT p.id id, p.name name,pt.id type_id ,pk.id kind_id, intro, price, p.image image, stock, added
            FROM pet p LEFT JOIN pet_type pt
            ON p.type_id = pt.id
            LEFT JOIN pet_kind pk
            ON p.kind_id = pk.id
            WHERE p.id = ?";

    $data = query($conn, $sql, $id);

    echo getJson(200, '获取成功', $data);
?>